// +-------------------------------- DISCLAIMER ---------------------------------+
// |                                                                             |
// | This program is provided to you free of charge "as such".                   |
// | You should not assume that this program is error-free or suitable for any   |
// | purpose whatsoever.                                                         |
// |                                                                             |
// | EURESYS does not give any representation, warranty or undertaking that this |
// | program is free of any defect or error or suitable for any purpose. EURESYS |
// | shall not be liable, in contract, in torts or otherwise, for any damages,   |
// | loss, costs, expenses or other claims for compensation, including those     |
// | asserted by third parties, arising out of or in connection with the use of  |
// | this program.                                                               |
// +-----------------------------------------------------------------------------+

#ifndef CAMERAWIDGET_H
#define CAMERAWIDGET_H

#include "CameraHandler.h"
#include "ProcessingHandler.h"

#include <QImage>
#include <QPixmap>
#include <QString>
#include <QWidget>
#include <QResizeEvent>


class CameraWidget : public QWidget
{
  Q_OBJECT
public:
  CameraWidget(const std::string& deepLearningModel, const std::string& cameraParams, QObject* parent = nullptr);
  ~CameraWidget();

protected:
  void paintEvent(QPaintEvent *) override;

private Q_SLOTS:
  void updatePixmap(const QImage &image, const QString &label);

private:
  bool resized_;  // resize widget when first image is read
  QPixmap pixmap_;
  QString label_;
  CameraHandler cameraHandler_;
  ProcessingHandler processingHandler_;  // after cameraHandler_ in class definition order because
  // destructor must be called before cameraHandler_
};

#endif // CAMERAWIDGET_H


